﻿using System;
using System.Collections.Generic;
using System.Linq.Expressions;

namespace Abp.Migration
{
    /// <summary>
    /// 实体映射接口
    /// </summary>
    public interface IEntityMapper
    {
        /// <summary>
        /// 表名
        /// </summary>
        string TableName { get; set; }
        /// <summary>
        /// 构架名
        /// </summary>
        string SchemaName { get; set; }
        /// <summary>
        /// 主键列名
        /// </summary>
        string IdName { get; set; }
        /// <summary>
        /// 外键名称，外键表：构架名，表名，列名，主键表：构架名，表名，主键列名
        /// </summary>
        Dictionary<string, Tuple<string, string, string, string, string, string>> ForeignKeyConfigurationCollection { get; set; }
        /// <summary>
        /// 构架，表名，列名(为空则是表注释)，注释
        /// </summary>
        List<Tuple<string, string, string, string>> AnnotationConfigurationCollection { get; set; }
    }

    /// <summary>
    /// 实体映射接口
    /// </summary>
    /// <typeparam name="T"></typeparam>
    public interface IEntityMapper<T> : IEntityMapper
    {
        /// <summary>
        /// 设置外键关系
        /// </summary>
        /// <typeparam name="TEntityMapper"></typeparam>
        /// <param name="memberExpression"></param>
        /// <param name="foreignKeyName"></param>
        void ForeignKey<TEntityMapper>(Expression<Func<T, object>> memberExpression, string foreignKeyName = "") where TEntityMapper : IEntityMapper;
    }
}
